package models;
import java.util.*;

import javax.persistence.*;

import org.joda.time.DateTime;

import play.data.validation.Min;
import play.data.validation.Required;
import play.db.jpa.*;
 
@Entity
public class Resultat extends Model
{
	@Required
	@ManyToOne
    public Modele_course modele;
	
	@Required
	@ManyToOne
    public Utilisateur utilisateur;
	
	@Required
	@Min(0)
	public int position_final;
	
	public Date date_resultat;
	
	@Required
	@Min(0)	
	public int score;
	
	@Min(0)	
	public int temp_total;
	
	public Resultat(Modele_course modele, Utilisateur utilisateur,
			int position_final, Date date_resultat, int score,
			int temp_total) 
	{
		this.modele = modele;
		this.utilisateur = utilisateur;
		this.position_final = position_final;
		this.date_resultat = date_resultat;
		this.score = score;
		this.temp_total = temp_total;
	}
	
	public String toString()
	{
		return this.modele.nom + " > " + this.utilisateur.pseudo + " : " + Integer.toString(score) ;
	}
	
	
}
